<html>
 <head>
  <link href="./leetcode-problem.css" rel="stylesheet" type="text/css">
 </head>
 <body>
  <div class="question_difficulty">
   难度：Medium
  </div>
  <div>
   <h1 class="question_title">
    74. Search a 2D Matrix
   </h1>
   <p>
    Write an efficient algorithm that searches for a value in an
    <em>
     m
    </em>
    x
    <em>
     n
    </em>
    matrix. This matrix has the following properties:
   </p>
   <ul>
    <li>
     Integers in each row are sorted from left to right.
    </li>
    <li>
     The first integer of each row is greater than the last integer of the previous row.
    </li>
   </ul>
   <p>
    <strong>
     Example 1:
    </strong>
   </p>
   <pre>
<strong>Input:</strong>
matrix = [
  [1,   3,  5,  7],
  [10, 11, 16, 20],
  [23, 30, 34, 50]
]
target = 3
<strong>Output:</strong> true
</pre>
   <p>
    <strong>
     Example 2:
    </strong>
   </p>
   <pre>
<strong>Input:</strong>
matrix = [
  [1,   3,  5,  7],
  [10, 11, 16, 20],
  [23, 30, 34, 50]
]
target = 13
<strong>Output:</strong> false</pre>
  </div>
  <div>
   <h1 class="question_title">
    74. 搜索二维矩阵
   </h1>
   <p>
    编写一个高效的算法来判断&nbsp;
    <em>
     m
    </em>
    x
    <em>
     n
    </em>
    &nbsp;矩阵中，是否存在一个目标值。该矩阵具有如下特性：
   </p>
   <ul>
    <li>
     每行中的整数从左到右按升序排列。
    </li>
    <li>
     每行的第一个整数大于前一行的最后一个整数。
    </li>
   </ul>
   <p>
    <strong>
     示例&nbsp;1:
    </strong>
   </p>
   <pre><strong>输入:</strong>
matrix = [
  [1,   3,  5,  7],
  [10, 11, 16, 20],
  [23, 30, 34, 50]
]
target = 3
<strong>输出:</strong> true
</pre>
   <p>
    <strong>
     示例&nbsp;2:
    </strong>
   </p>
   <pre><strong>输入:</strong>
matrix = [
  [1,   3,  5,  7],
  [10, 11, 16, 20],
  [23, 30, 34, 50]
]
target = 13
<strong>输出:</strong> false</pre>
  </div>
 </body>
</html>